home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-05-23 | 43.5 KB | 1,767 lines | [TEXT/MPS ] |
- {*******************************************************************************
- UCharacterDialog.inc1.p
- *******************************************************************************}
-
- USES
- { • Implementation use }
- Fonts,
- Packages,
- Picker, { TColorDialogCmd }
- Resources,
- ToolUtils; { TColorDialogCmd }
-
- TYPE
- FondHandle = ^FondPointer;
- FondPointer = ^FondRecord;
- FondRecord = RECORD
- familyStuff: FamRec;
- noOfFonts: INTEGER;
- fontStuff: ARRAY [0..1000] OF RECORD
- size: INTEGER;
- style: INTEGER;
- resID: INTEGER;
- END;
- END;
-
- {###############################################################################
- Unit Initialization
- ###############################################################################}
-
- {——————————————————————————————————————————————————————————————————————————————}
- {$S AInit}
-
- PROCEDURE InitUCharacterDialog;
- VAR
- dummy: BOOLEAN;
-
- BEGIN
- IF gDeadStripSuppression
- THEN
- BEGIN
- { list the views instantiated via resource templates below }
- dummy := Member(TObject(NIL), TCharDialogView);
- dummy := Member(TObject(NIL), TFaceCluster);
- dummy := Member(TObject(NIL), TFontListView);
- dummy := Member(TObject(NIL), TJustifyCluster);
- dummy := Member(TObject(NIL), TSampleText);
- dummy := Member(TObject(NIL), TSetCluster);
- dummy := Member(TObject(NIL), TSizeCluster);
- dummy := Member(TObject(NIL), TSizeListView);
- dummy := Member(TObject(NIL), TSizeText);
- dummy := Member(TObject(NIL), TSpaceCluster);
- dummy := Member(TObject(NIL), TStyleCluster);
- dummy := Member(TObject(NIL), TValueCheckBox);
- dummy := Member(TObject(NIL), TValueRadio);
- dummy := Member(TObject(NIL), TValueRadioCluster);
- END; { if gDeadStripSuppression }
- END; { InitUCharacterDialog }
-
-
- {###############################################################################
- Utility Routines
- ###############################################################################}
-
- {——————————————————————————————————————————————————————————————————————————————}
- {$ AUtil}
-
- FUNCTION SameRGBColor(color1, color2: RGBColor): BOOLEAN;
- BEGIN
- SameRGBColor := (color1.red = color2.red) &
- (color1.green = color2.green) &
- (color1.blue = color2.blue);
- END; { SameRGBColor }
-
- {——————————————————————————————————————————————————————————————————————————————}
- {$ AUtil}
-
- FUNCTION SameTextStyle(style1, style2: TextStyle): BOOLEAN;
- BEGIN
- SameTextStyle := (style1.tsFont = style2.tsFont) &
- (style1.tsFace = style2.tsFace) &
- (style1.tsSize = style2.tsSize) &
- SameRGBColor(style1.tsColor, style2.tsColor);
- END; { SameTextStyle }
-
- {——————————————————————————————————————————————————————————————————————————————}
- {$ AUtil}
-
- { AffectTextStyle(): Uses the given source TextStyle to modify the
- given target TextStyle according to the given mode, in a manner
- similar to that used in TTEView.SetOneStyle(). Note that
- "mode" may include flags for setting the alignment, as defined
- above; if present, they are ignored. }
- PROCEDURE AffectTextStyle(
- theMode: INTEGER;
- VAR source: TextStyle; { not changed }
- VAR target: TextStyle);
- BEGIN
- IF (theMode IN [doAll, doAllAndAlign])
- THEN
- target := source { ignore alignment }
- ELSE
- BEGIN
- IF BAND(theMode, doFont) <> 0
- THEN
- target.tsFont := source.tsFont;
-
- IF BAND(theMode, doPlusFace) <> 0
- THEN
- target.tsFace := target.tsFace + source.tsFace
- ELSE IF BAND(theMode, doMinusFace) <> 0
- THEN
- target.tsFace := target.tsFace - source.tsFace
- ELSE IF BAND(theMode, doFace) <> 0
- THEN
- target.tsFace := source.tsFace;
-
- IF BAND(theMode, doColor) <> 0
- THEN
- target.tsColor := source.tsColor;
-
- IF BAND(theMode, addSize) <> 0
- THEN
- target.tsSize := target.tsSize + source.tsSize
- ELSE IF BAND(theMode, doSize) <> 0
- THEN
- target.tsSize := source.tsSize;
-
- { make sure that condense and extend are never turned on together }
- IF (theMode IN [doAll, doAllAndAlign, doPlusFace, doFace]) &
- (target.tsFace * [condense, extend] = [condense, extend])
- THEN
- target.tsFace := target.tsFace - [condense, extend];
- END;
- END; { AffectTextStyle }
-
- {——————————————————————————————————————————————————————————————————————————————}
- {$ AUtil}
-
- { AffectTextAlignment(): Uses the given source alignment to modify
- the given target alignment according to the given mode, in a
- manner similar to that used in TTEView.SetOneStyle(). Note that
- "mode" may include flags for setting the alignment, as defined
- above. }
- PROCEDURE AffectTextAlignment(
- theMode: INTEGER;
- source: INTEGER;
- VAR target: INTEGER);
- BEGIN
- IF (theMode = doAllAndAlign) |
- (BAND(theMode, doAlign) <> 0)
- THEN
- target := source; { !!! GetActualJustification(source) ??? }
- END; { AffectTextAlignment }
-
- {——————————————————————————————————————————————————————————————————————————————}
- {$ AUtil}
-
- { AffectTextStyleAndAlign(): Uses the given source TextStyle and
- alignment to modify the given target TextStyle and alignment
- according to the given mode, in a manner similar to that used in
- TTEView.SetOneStyle(). Note that "mode" may include flags for
- setting the alignment, as defined above. }
- PROCEDURE AffectTextStyleAndAlign(
- theMode: INTEGER;
- VAR sourceTS: TextStyle; { not changed }
- sourceAlign: INTEGER;
- VAR targetTS: TextStyle;
- VAR targetAlign: INTEGER);
- BEGIN
- AffectTextStyle(theMode, sourceTS, targetTS);
- AffectTextAlignment(theMode, sourceAlign, targetAlign);
- END; { AffectTextStyleAndAlign }
-
-
- {###############################################################################
- TCharDialogView
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S AOpen}
-
- { PostRes(): Initialize the dialog's subview references. }
- PROCEDURE TCharDialogView.PostRes;
- OVERRIDE;
- VAR
- aView: TView;
-
- BEGIN
- INHERITED PostRes;
-
- aView := FindSubView('sclu');
- FailNil(aView);
- fSizeCluster := TSizeCluster(aView);
-
- aView := FindSubView('just');
- FailNil(aView);
- fJustCluster := TJustifyCluster(aView);
-
- aView := FindSubView('flst');
- FailNil(aView);
- fFontListView := TFontListView(aView);
-
- aView := FindSubView('samp');
- FailNil(aView);
- fSampleText := TSampleText(aView);
-
- aView := FindSubView('face');
- FailNil(aView);
- fFaceCluster := TFaceCluster(aView);
- END; { PostRes }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- { SetDialogInfo(): Initializes the dialog to reflect the given TextStyle
- record and alignment value. }
- PROCEDURE TCharDialogView.SetDialogInfo(
- theStyle: TextStyle;
- alignment: INTEGER;
- redraw: BOOLEAN);
- BEGIN
- WITH theStyle DO
- BEGIN
- SetTextFont(tsFont, redraw);
- SetTextSize(tsSize, redraw);
- SetTextFace(tsFace, redraw);
- SetTextColor(tsColor, redraw);
- END;
-
- SetTextJust(alignment, redraw);
- END; { SetDialogInfo }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- { GetDialogInfo(): Returns the dialog's current TextStyle record and
- alignment value. }
- PROCEDURE TCharDialogView.GetDialogInfo(
- VAR theStyle: TextStyle;
- VAR alignment: INTEGER);
- BEGIN
- fSampleText.GetTextInfo(theStyle, alignment);
- END; { GetDialogInfo }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- PROCEDURE TCharDialogView.SetTextFont(
- theFont: INTEGER;
- redraw: BOOLEAN);
- BEGIN
- { the call below is redundant, if in response to DoChoice(mFontChanged) }
- fFontListView.SetTextFont(theFont,redraw);
-
- { always necessary }
- fSizeCluster.SetTextFont(theFont, redraw);
- fSampleText.SetTextFont(theFont, redraw);
- END; {SetTextFont}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TCharDialogView.SetTextSize(
- theSize: INTEGER;
- redraw: BOOLEAN);
- BEGIN
- fSizeCluster.SetTextSize(theSize,redraw);
- fSampleText.SetTextSize(theSize,redraw);
- END; {SetTextSize}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TCharDialogView.SetTextFace(
- theFace: Style;
- redraw: BOOLEAN);
- BEGIN
- fSampleText.SetTextFace(theFace,redraw);
- fFaceCluster.SetTextFace(theFace,redraw);
- END; {SetTextFace}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- PROCEDURE TCharDialogView.SetTextColor(
- theColor: RGBColor;
- redraw: BOOLEAN);
- BEGIN
- fSampleText.SetTextColor(theColor, redraw);
- END; {SetTextColor}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- PROCEDURE TCharDialogView.SetTextJust(
- alignment: INTEGER;
- redraw: BOOLEAN);
- BEGIN
- fSampleText.SetTextJust(alignment, redraw);
- fJustCluster.SetTextJust(alignment, redraw);
- END; { SetTextJust }
-
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TCharDialogView.DoChoice(
- origView: TView;
- itsChoice: INTEGER);
- OVERRIDE;
- BEGIN
- CASE itsChoice OF
- mFontChanged:
- BEGIN
- SetTextFont(fFontListView.GetTextFont,kRedraw);
- END;
-
- mFontSizeChanged:
- BEGIN
- SetTextSize(fSizeCluster.GetTextSize,kRedraw);
- END;
-
- OTHERWISE
- INHERITED DoChoice(origView, itsChoice);
- END; { case }
- END; { DoChoice }
-
-
- {###############################################################################
- TValueCheckBox
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- PROCEDURE TValueCheckBox.IRes(
- itsDocument: TDocument;
- itsSuperView: TView;
- VAR itsParams: Ptr);
- OVERRIDE;
- BEGIN
- INHERITED IRes(itsDocument, itsSuperView, itsParams);
-
- WITH ValueCheckBoxTemplatePtr(itsParams)^ DO
- BEGIN
- fNumber := number;
- END;
-
- OffsetPtr(itsParams, SIZEOF(ValueCheckBoxTemplate));
- END; { IRes }
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- PROCEDURE TValueCheckBox.SetNumber(
- number: INTEGER);
- BEGIN
- fNumber := number;
- END; { SetNumber }
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- FUNCTION TValueCheckBox.GetNumber
- :INTEGER;
- BEGIN
- GetNumber := fNumber;
- END; { GetNumber }
-
- {------------------------------------------------------------------------------}
- {$S AFields}
-
- {$IFC qInspector}
- PROCEDURE TValueCheckBox.Fields(
- PROCEDURE DoToField(
- fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER));
- OVERRIDE;
- BEGIN
- DoToField('TValueCheckBox', NIL, bClass);
- DoToField('fNumber', @fNumber, bInteger);
-
- INHERITED Fields(DoToField);
- END; { Fields }
- {$ENDC qDebug}
-
-
- {###############################################################################
- TValueRadio
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- PROCEDURE TValueRadio.IRes(
- itsDocument: TDocument;
- itsSuperView: TView;
- VAR itsParams: Ptr);
- OVERRIDE;
- BEGIN
- INHERITED IRes(itsDocument, itsSuperView, itsParams);
-
- WITH ValueRadioTemplatePtr(itsParams)^ DO
- BEGIN
- fNumber := number;
- END;
-
- OffsetPtr(itsParams, SIZEOF(ValueRadioTemplate));
- END; { IRes }
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- PROCEDURE TValueRadio.SetNumber(
- number: INTEGER);
- BEGIN
- fNumber := number;
- END; { SetNumber }
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- FUNCTION TValueRadio.GetNumber
- :INTEGER;
- BEGIN
- GetNumber := fNumber;
- END; { GetNumber }
-
- {------------------------------------------------------------------------------}
- {$S AFields}
-
- {$IFC qInspector}
- PROCEDURE TValueRadio.Fields(
- PROCEDURE DoToField(
- fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER));
- OVERRIDE;
- BEGIN
- DoToField('TValueRadio', NIL, bClass);
- DoToField('fNumber', @fNumber, bInteger);
-
- INHERITED Fields(DoToField);
- END; { Fields }
- {$ENDC qDebug}
-
-
-
- {###############################################################################
- TSetCluster
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- { IRes(): Sets fSet to []. }
- PROCEDURE TSetCluster.IRes(
- itsDocument: TDocument;
- itsSuperView: TView;
- VAR itsParams: Ptr);
- OVERRIDE;
- BEGIN
- INHERITED IRes(itsDocument, itsSuperView, itsParams);
-
- fSet := [];
- END; { IRes }
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- PROCEDURE TSetCluster.SetTheSet(
- theSet: ValueSet;
- redraw: BOOLEAN);
-
- {--------------------------------------------------------------------------}
-
- PROCEDURE SetOrClearSubview(aView: TView);
- VAR
- number: INTEGER;
- inNewState: BOOLEAN;
-
- BEGIN
- IF Member(aView, TValueCheckbox)
- THEN
- BEGIN
- number := TValueCheckbox(aView).GetNumber;
-
- IF (theSet = []) & (number = kEmptySet)
- THEN
- TValueCheckbox(aView).SetState(TRUE, redraw)
- ELSE
- BEGIN
- inNewState := (number IN theSet);
-
- IF (TValueCheckbox(aView).IsOn <> inNewState)
- THEN
- TValueCheckbox(aView).SetState(inNewState, redraw);
- END; { else }
- END; { if is TValueCheckbox }
- END; { SetOrClearSubview }
-
- {--------------------------------------------------------------------------}
-
- BEGIN { SetTheSet }
- IF (theSet <> fSet)
- THEN
- BEGIN
- fSet := theSet;
-
- EachSubview(SetOrClearSubview);
- END;
- END; { SetTheSet }
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- FUNCTION TSetCluster.GetTheSet
- : ValueSet;
- BEGIN
- GetTheSet := fSet;
- END; { GetTheSet }
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- PROCEDURE TSetCluster.DoCheckBoxHit(
- VAR origView: TView;
- VAR itsChoice: INTEGER);
- VAR
- number: INTEGER;
-
- BEGIN
- { modify the set value as necessary }
- IF Member(origView, TValueCheckBox)
- THEN
- BEGIN
- number := TValueCheckBox(origView).GetNumber;
-
- IF (kMinValue <= number) & (number <= kMaxValue)
- THEN
- BEGIN
- IF (TValueCheckBox(origView).IsOn)
- THEN
- SetTheSet(fSet + [number], kRedraw)
- ELSE
- SetTheSet(fSet - [number], kRedraw);
- END { if in range }
- ELSE IF (number = kEmptySet)
- THEN
- SetTheSet([], kRedraw)
- ELSE
- BEGIN
- {$IFC qDebug}
- (*
- write( 'In TSetCluster.DoChoice(), number is out of range: ');
- writeln('(', kMinValue:1, ' <= ', number:1, ') & (', number:1, ' <= ', kMaxValue:1, ')');
- *)
- {$ENDC qDebug}
- END; { out of range }
- END; { if is member }
- END; { DoCheckBoxHit }
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- PROCEDURE TSetCluster.DoRadioHit(
- VAR origView: TView;
- VAR itsChoice: INTEGER);
- VAR
- number: INTEGER;
-
- BEGIN
- IF (Member(origView, TValueRadio))
- THEN
- BEGIN
- number := TValueRadio(origView).GetNumber;
-
- IF (kMinValue <= number) & (number <= kMaxValue)
- THEN
- SetTheSet([number], kRedraw)
- ELSE IF (number = kEmptySet)
- THEN
- SetTheSet([], kRedraw)
- ELSE
- BEGIN
- {$IFC qDebug}
- write( 'In TSetCluster.DoChoice(), number is out of range: ');
- writeln('(', kMinValue:1, ' <= ', number:1, ') & (', number:1, ' <= ', kMaxValue:1, ')');
- {$ENDC qDebug}
- END; { out of range }
- END; { if is member }
- END; { DoRadioHit }
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- PROCEDURE TSetCluster.DoChoice(
- origView: TView;
- itsChoice: INTEGER);
- OVERRIDE;
- VAR
- callDoChoice: BOOLEAN;
-
- BEGIN
- IF (origView.fSuperView = SELF) { Only worry about it if it's our subview! }
- THEN
- BEGIN
- CASE itsChoice OF
- mCheckBoxHit: DoCheckBoxHit(origView, itsChoice);
- mRadioHit: DoRadioHit(origView, itsChoice);
-
- OTHERWISE ;{ nothing special }
- END; { case }
- END; { our subView }
-
- INHERITED DoChoice(origView, itsChoice);
- END; { DoChoice }
-
- {------------------------------------------------------------------------------}
- {$S AFields}
-
- {$IFC qInspector}
- PROCEDURE TSetCluster.Fields(
- PROCEDURE DoToField(
- fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER));
- OVERRIDE;
- VAR
- i: ValueRange;
- iStr: Str255;
- isInSet: BOOLEAN;
-
- BEGIN
- DoToField('TSetCluster', NIL, bClass);
- DoToField('fSet', @fSet, bHexLongint); { because it contains only 31 members }
-
- FOR i := kMinValue to kMaxValue DO
- BEGIN
- isInSet := i IN fSet;
-
- NumToString(LONGINT(i), iStr);
- DoToField(Concat(' ', iStr), @isInSet, bBoolean);
- END;
-
- INHERITED Fields(DoToField);
- END; { Fields }
- {$ENDC qDebug}
-
-
- {###############################################################################
- TValueRadioCluster
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- FUNCTION TValueRadioCluster.GetNumber
- :INTEGER;
- VAR
- Valueradio: TValueRadio;
-
- {--------------------------------------------------------------------------}
-
- FUNCTION IsSelectedValueRadio(aView: TView): BOOLEAN;
- BEGIN
- IsSelectedValueRadio := Member(aView, TValueRadio) & TValueRadio(aView).IsOn;
- END; { IsSelectedValueRadio }
-
-
- {--------------------------------------------------------------------------}
-
- BEGIN { GetNumber }
- Valueradio := TValueRadio(FirstSubViewThat(IsSelectedValueRadio));
-
- IF (Valueradio = NIL)
- THEN
- GetNumber := kBadValue
- ELSE
- GetNumber := Valueradio.GetNumber;
- END; { GetNumber }
-
-
- {------------------------------------------------------------------------------}
- {$S AUtilities}
-
- PROCEDURE TValueRadioCluster.SetNumber(
- number :INTEGER;
- redraw: BOOLEAN);
-
- {--------------------------------------------------------------------------}
-
- PROCEDURE SetOrClearSubview(aView: TView);
- BEGIN
- IF Member(aView, TValueRadio)
- THEN
- TValueRadio(aView).SetState((TValueRadio(aView).GetNumber = number),
- redraw);
- END; { SetOrClearSubview }
-
-
- {--------------------------------------------------------------------------}
-
- BEGIN { SetNumber }
- EachSubview(SetOrClearSubview);
- END; { SetNumber }
-
-
- {------------------------------------------------------------------------------}
- {$S AFields}
-
- {$IFC qInspector}
- PROCEDURE TValueRadioCluster.Fields(
- PROCEDURE DoToField(
- fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER));
- OVERRIDE;
- VAR
- number: INTEGER;
-
- BEGIN
- DoToField('TValueRadioCluster', NIL, bClass);
-
- number := GetNumber;
- DoToField('current number', @number, bInteger);
-
- INHERITED Fields(DoToField);
- END; { Fields }
- {$ENDC qDebug}
-
-
- {###############################################################################
- TSampleText
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S AOpen}
-
- { PostRes(): Initialize the dialog's subview references. }
- PROCEDURE TSampleText.PostRes;
- OVERRIDE;
- BEGIN
- ChangeWrap(TRUE, { DO wrap text }
- kDontRedraw); { DON'T redraw }
- END; { PostRes }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSampleText.GetTextInfo(
- VAR theStyle: TextStyle;
- VAR alignment: INTEGER);
- BEGIN
- theStyle := fTextStyle;
- alignment := fJust;
- END; { GetTextInfo }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSampleText.GetTextStyle(
- VAR theStyle: TextStyle);
- BEGIN
- theStyle := fTextStyle;
- END; { GetTextStyle }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSampleText.SetTextStyle(
- mode: INTEGER;
- theTextStyle: TextStyle;
- redraw: BOOLEAN);
- VAR
- localTextStyle: TextStyle;
- ctlRect: Rect;
-
- BEGIN
- localTextStyle := fTextStyle; { a TStaticText field }
- AffectTextStyle(mode, theTextStyle, localTextStyle);
- InstallTextStyle(localTextStyle, kDontRedraw); { a TControl method }
-
- IF redraw
- THEN
- BEGIN
- ControlArea(ctlRect);
- InvalidRect(ctlRect);
- END;
- END; { SetTextStyle }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSampleText.SetTextFont(
- theFont: INTEGER;
- redraw: BOOLEAN);
- VAR
- aTextStyle: TextStyle;
-
- BEGIN
- GetTextStyle(aTextStyle);
-
- IF (theFont <> aTextStyle.tsFont)
- THEN
- BEGIN
- aTextStyle.tsFont := theFont;
- SetTextStyle(doFont,aTextStyle,redraw);
- END;
- END; {SetTextFont}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSampleText.SetTextSize(
- theSize: INTEGER;
- redraw: BOOLEAN);
- VAR
- aTextStyle: TextStyle;
-
- BEGIN
- GetTextStyle(aTextStyle);
-
- IF (aTextStyle.tsSize <> theSize)
- THEN
- BEGIN
- aTextStyle.tsSize := theSize;
- SetTextStyle(doSize,aTextStyle,redraw)
- END;
- END; {SetTextSize}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSampleText.SetTextFace(
- theFace: Style;
- redraw: BOOLEAN);
- VAR
- aTextStyle: TextStyle;
-
- BEGIN
- GetTextStyle(aTextStyle);
-
- IF (aTextStyle.tsFace <> theFace)
- THEN
- BEGIN
- aTextStyle.tsFace := theFace;
- SetTextStyle(doFace,aTextStyle,redraw);
- END;
- END; {SetTextFace}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- PROCEDURE TSampleText.SetTextColor(
- theColor: RGBColor;
- redraw: BOOLEAN);
- VAR
- aTextStyle: TextStyle;
-
- BEGIN
- GetTextStyle(aTextStyle);
-
- IF (NOT SameRGBColor(aTextStyle.tsColor, theColor)) { UProtoUtilities }
- THEN
- BEGIN
- aTextStyle.tsColor := theColor;
- SetTextStyle(doColor,aTextStyle,redraw);
- END;
- END; { SetTextColor }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- PROCEDURE TSampleText.SetTextJust(
- alignment: INTEGER;
- redraw: BOOLEAN);
- BEGIN
- IF (fJust <> alignment)
- THEN
- SetJustification(alignment, redraw);
- END; { SetTextJust }
-
-
- {###############################################################################
- TJustifyCluster
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S AOpen}
-
- { PostRes(): Initialize the dialog's subview references. }
- PROCEDURE TJustifyCluster.PostRes;
- OVERRIDE;
- VAR
- aView: TView;
-
- BEGIN
- INHERITED PostRes;
-
- aView := GetDialogView.FindSubView('samp');
- FailNil(aView);
- fSampleText := TSampleText(aView);
- END; { PostRes }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TJustifyCluster.DoChoice(
- origView: TView;
- itsChoice: INTEGER);
- BEGIN
- INHERITED DoChoice(origView,itsChoice);
-
- IF (itsChoice = mRadioHit) & (TRadio(origView).IsOn)
- THEN
- fSampleText.SetTextJust(GetNumber,kRedraw)
- END; { DoChoice }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- PROCEDURE TJustifyCluster.SetTextJust(
- alignment: INTEGER;
- redraw: BOOLEAN);
- BEGIN
- IF (GetNumber <> alignment)
- THEN
- SetNumber(alignment, redraw);
- END; { SetTextJust }
-
-
- {###############################################################################
- TStyleCluster
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- PROCEDURE TStyleCluster.SetTextFace(
- theFace: Style;
- redraw: BOOLEAN);
- VAR
- theSet: ValueSet; { see UProtoControls.p }
- aStyleItem: StyleItem; { see IM v1 p201 }
-
- BEGIN
- IF (GetTextFace <> theFace)
- THEN
- BEGIN { convert Style to ValueSet }
- theSet := [];
-
- IF (theFace <> [])
- THEN
- BEGIN
- FOR aStyleItem := bold TO shadow DO { ignore condense and extend }
- BEGIN
- IF (aStyleItem IN theFace)
- THEN
- theSet := theSet + [ord(aStyleItem)];
- END; { for }
- END; { if }
-
- SetTheSet(theSet, redraw);
- END;
- END; { SetTextFace }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- FUNCTION TStyleCluster.GetTextFace
- : Style;
- VAR
- aStyleItem: StyleItem;
- result: Style;
-
- BEGIN
- result := [];
-
- IF (fSet <> [])
- THEN
- BEGIN
- FOR aStyleItem := bold TO shadow DO
- BEGIN
- IF (ord(aStyleItem) IN fSet)
- THEN
- result := result + [aStyleItem];
- END; { for }
- END; { if }
-
- GetTextFace := result;
- END; { GetTextFace }
-
-
- {###############################################################################
- TSpaceCluster
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- PROCEDURE TSpaceCluster.SetTextFace(
- theFace: Style;
- redraw: BOOLEAN);
- VAR
- theNumber: INTEGER;
-
- BEGIN
- IF (GetTextFace <> theFace)
- THEN
- BEGIN { convert Style to INTEGER }
- IF (condense IN theFace)
- THEN
- theNumber := ord(condense)
- ELSE IF (extend IN theFace)
- THEN
- theNumber := ord(extend)
- ELSE
- theNumber := kNormalSpacing;
-
- SetNumber(theNumber, redraw);
- END;
- END; { SetTextFace }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- FUNCTION TSpaceCluster.GetTextFace
- : Style;
- VAR
- theNumber: INTEGER;
-
- BEGIN
- theNumber := GetNumber;
-
- IF (theNumber = ord(condense))
- THEN
- GetTextFace := [condense]
- ELSE IF (theNumber = ord(extend))
- THEN
- GetTextFace := [extend]
- ELSE
- GetTextFace := [];
- END; { GetTextFace }
-
-
- {###############################################################################
- TFaceCluster
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S AOpen}
-
- { PostRes(): Initialize the dialog's subview references. }
- PROCEDURE TFaceCluster.PostRes;
- OVERRIDE;
- VAR
- aView: TView;
-
- BEGIN
- INHERITED PostRes;
-
- aView := FindSubView('styl');
- FailNil(aView);
- fStyleCluster := TStyleCluster(aView);
-
- aView := FindSubView('spac');
- FailNil(aView);
- fSpaceCluster := TSpaceCluster(aView);
-
- aView := GetDialogView.FindSubView('samp');
- FailNil(aView);
- fSampleText := TSampleText(aView);
- END; { PostRes }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TFaceCluster.DoChoice(
- origView: TView;
- itsChoice: INTEGER);
- BEGIN
- IF (itsChoice IN [mCheckBoxHit, mRadioHit])
- THEN
- fSampleText.SetTextFace(GetTextFace, kRedraw);
-
- INHERITED DoChoice(origView, itsChoice);
- END; { DoChoice }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- PROCEDURE TFaceCluster.SetTextFace(
- theFace: Style;
- redraw: BOOLEAN);
- BEGIN
- IF (GetTextFace <> theFace)
- THEN
- BEGIN
- fStyleCluster.SetTextFace(theFace, redraw);
- fSpaceCluster.SetTextFace(theFace, redraw);
- END;
- END; { SetTextFace }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
-
- FUNCTION TFaceCluster.GetTextFace
- : Style;
- BEGIN
- GetTextFace := fStyleCluster.GetTextFace + fSpaceCluster.GetTextFace;
- END; { GetTextFace }
-
-
- {###############################################################################
- TFontListView
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S AOpen}
-
- { PostRes(): Calls InitFontList(). }
- PROCEDURE TFontListView.PostRes;
- OVERRIDE;
- BEGIN
- INHERITED PostRes;
-
- { build the font list }
- InitFontList;
-
- {$IFC qDebug}
- Assertion((fNumOfRows >= 1), AtStr('(fNumOfRows >= 1)'));
- {$ENDC qDebug}
-
- { select the first item }
- SetSelectionRect(1, 1, 1, 1, kDontExtend, kHighlight, kSelect);
- END; { PostRes }
-
- {------------------------------------------------------------------------------}
- {$S AOpen}
- PROCEDURE TFontListView.InitFontList;
-
- VAR
- pFondIDs: FontListPtr;
- i: INTEGER;
- noOfFonds: INTEGER;
- aString: Str255;
-
- {--------------------------------------------------------------------------}
-
- FUNCTION FondAfter(VAR fontName: Str255): INTEGER;
- { Find the FOND whose name follows fontName alphabetically, and return its id and name }
-
- VAR
- theFondResource: Handle;
- lastID: INTEGER;
- thisID: INTEGER;
- itsType: ResType;
- index: INTEGER;
- foundFOND: BOOLEAN;
- lastName: Str255;
- thisName: Str255;
-
- BEGIN
- lastID := 0;
- foundFOND := FALSE;
- lastName := '~~~~~~~~';
-
- FOR index := 1 to noOfFonds DO
- BEGIN
- theFondResource := GetIndResource('FOND', index);
- GetResInfo(theFondResource, thisID, itsType, thisName);
-
- IF (thisName > fontName) & (thisName < lastName) THEN
- BEGIN
- lastID := thisID;
- CopyStr255(thisName, @lastName);
- foundFOND := TRUE;
- END;
- END;
-
- IF foundFOND THEN
- CopyStr255(lastName, @fontName)
- ELSE { Skip duplicate FOND names }
- fontName := '';
-
- FondAfter := lastID;
- END; { FondAfter }
-
- {--------------------------------------------------------------------------}
-
- BEGIN { InitFontList }
- fFontList := NIL;
- noOfFonds := CountResources('FOND');
- IF noOfFonds > kMaxFonds THEN
- noOfFonds := kMaxFonds;
- pFondIDs := FontListPtr(NewPermPtr(noOfFonds * sizeof(INTEGER)));
- FailNIL(pFondIDs);
-
- aString := ' ';
- FOR i := 1 TO noOfFonds DO
- BEGIN { put each FOND's id in the list… }
- pFondIDs^[i] := FondAfter(aString); { …in alphabetical order }
- IF length(aString) = 0 THEN { we finished early }
- BEGIN
- noOfFonds := i-1;
- LEAVE;
- END;
- END;
-
- fFontList := pFondIDs;
- InsItemLast(noOfFonds)
- END; { InitFontList }
-
- {------------------------------------------------------------------------------}
- {$S AClose}
- PROCEDURE TFontListView.Free;
- OVERRIDE;
-
- BEGIN
- Ptr(fFontList) := DisposeIfPtr(fFontList);
-
- INHERITED Free;
- END;
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TFontListView.GetItemText(
- anItem: INTEGER;
- VAR aString: Str255);
- OVERRIDE;
-
- VAR
- theFondResource: Handle;
- itsID: INTEGER;
- itsType: ResType;
-
- BEGIN
- theFondResource := GetResource('FOND', fFontList^[anItem]);
- GetResInfo(theFondResource, itsID, itsType, aString);
- END;
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TFontListView.SetTextFont(
- theFont: INTEGER;
- redraw: BOOLEAN);
- VAR
- item: INTEGER;
-
- BEGIN
- IF (GetTextFont <> theFont)
- THEN
- BEGIN
- item := fNumOfRows; { find the list item that is displaying theFont }
- WHILE (item >= 1) & (fFontList^[item] <> theFont) DO
- BEGIN
- item := item - 1;
- END;
-
- IF (fFontList^[item] = theFont) { found it }
- THEN
- BEGIN
- SelectItem(item,
- kDontExtend,
- kHighlight,
- kSelect);
- END
- ELSE
- BEGIN
- SetEmptySelection(kHighlight);
-
- {$IFC qDebug}
- ProgramBreak('In TFontListView.SetTextFont(), a missing font was set (bad!).');
- {$ENDC qDebug}
- END;
- END;
- END; { SetTextFont }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- FUNCTION TFontListView.GetTextFont
- :INTEGER;
-
- VAR
- aString: Str255;
- aFontNumber: INTEGER;
-
- BEGIN
- GetItemText(LastSelectedItem,aString);
- GetFNum(aString,aFontNumber);
- GetTextFont := aFontNumber;
- END;
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TFontListView.SelectItem(
- anItem: INTEGER;
- extendSelection,
- highlight,
- select: BOOLEAN);
- OVERRIDE;
- BEGIN
- INHERITED SelectItem(anItem, extendSelection, highlight, select);
-
- IF select
- THEN
- DoChoice(SELF,mFontChanged)
- END;
-
- {------------------------------------------------------------------------------}
- {$S AFields}
-
- {$IFC qInspector}
- PROCEDURE TFontListView.Fields(PROCEDURE DoToField(fieldName: Str255; fieldAddr: Ptr;
- fieldType: INTEGER)); OVERRIDE;
-
- BEGIN
- DoToField('TFontListView', NIL, bClass);
- DoToField('fFontList', @fFontList, bPointer);
- INHERITED Fields(DoToField);
- END;
- {$ENDC qInspector}
-
-
- {###############################################################################
- TSizeListView
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- FUNCTION TSizeListView.GetItemSize(
- anItem: INTEGER)
- :INTEGER;
-
- VAR
- i: INTEGER;
- noOfSizes: INTEGER;
- theFond: FondHandle;
-
- BEGIN
- theFond := FondHandle(GetResource('FOND', fFondID));
-
- noOfSizes := 0;
- FOR i := 0 TO theFond^^.noOfFonts DO
- BEGIN
- IF theFond^^.fontStuff[i].style = 0 THEN
- noOfSizes := noOfSizes + 1;
-
- IF noOfSizes = anItem THEN
- BEGIN
- GetItemSize := theFond^^.fontStuff[i].size;
- EXIT(GetItemSize);
- END;
- END;
-
- GetItemSize := 0;
- END; {GetItemSize}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- FUNCTION TSizeListView.FindSizeItem(
- theSize: INTEGER)
- :INTEGER;
- VAR
- i: INTEGER;
-
- BEGIN
- FOR i := 1 TO fNumOfRows DO
- BEGIN
- IF theSize=GetItemSize(i)
- THEN
- BEGIN
- FindSizeItem := i;
- EXIT(FindSizeItem)
- END;
- END; { for }
-
- FindSizeItem := 0;
- END; {FindSizeItem}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- FUNCTION TSizeListView.GetTextSize
- :INTEGER;
- BEGIN
- GetTextSize := GetItemSize(LastSelectedItem)
- END;
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSizeListView.SetTextSize(
- theSize: INTEGER;
- redraw: BOOLEAN);
-
- VAR
- anItem: INTEGER;
-
- BEGIN
- IF (GetTextSize <> theSize)
- THEN
- BEGIN
- anItem := FindSizeItem(theSize);
-
- IF anItem <> 0
- THEN
- INHERITED SelectItem(anItem, kDontExtend, kHighlight, kSelect);
- END;
- END;
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSizeListView.GetItemText(
- anItem: INTEGER;
- VAR aString: Str255);
- OVERRIDE;
- BEGIN
- NumToString(GetItemSize(anItem), aString);
- END;
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSizeListView.SetNumberOfItems(
- aNumber: INTEGER);
-
- BEGIN
- IF fNumOfRows > aNumber
- THEN
- DelItemFirst(fNumOfRows - aNumber)
- ELSE IF fNumOfRows < aNumber
- THEN
- InsItemFirst(aNumber - fNumOfRows);
- END;
-
- {------------------------------------------------------------------------------}
- {$S AOpen}
- PROCEDURE TSizeListView.InstallFontFamily(
- theFondID: INTEGER);
-
- VAR
- theFond: FondHandle;
- noOfSizes: INTEGER;
- i: INTEGER;
-
- BEGIN
- theFond := FondHandle(GetResource('FOND', theFondID));
-
- noOfSizes := 0;
- FOR i := 0 TO theFond^^.noOfFonts DO
- BEGIN
- IF theFond^^.fontStuff[i].style = 0
- THEN
- noOfSizes := noOfSizes + 1;
- END; { for }
-
- fFondID := theFondID;
- SetNumberOfItems(noOfSizes);
- ForceRedraw;
- END;
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSizeListView.SelectItem(
- anItem: INTEGER;
- extendSelection: BOOLEAN;
- highlight: BOOLEAN;
- select: BOOLEAN);
- BEGIN
- { if anItem is 0, row 1 is selected }
- INHERITED SelectItem(anItem, extendSelection, highlight, select);
-
- IF select & (anItem <> 0)
- THEN
- DoChoice(SELF, mListFontSizeChanged);
- END;
-
- {------------------------------------------------------------------------------}
- {$S AFields}
- PROCEDURE TSizeListView.Fields(PROCEDURE DoToField(fieldName: Str255; fieldAddr: Ptr;
- fieldType: INTEGER)); OVERRIDE;
-
- BEGIN
- DoToField('TSizeListView', NIL, bClass);
- DoToField('fFondID', @fFondID, bInteger);
- INHERITED Fields(DoToField);
- END;
-
-
- {###############################################################################
- TSizeText
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- FUNCTION TSizeText.GetTextSize
- :INTEGER;
- BEGIN
- GetTextSize := GetValue
- END; {GetTextSize}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSizeText.SetTextSize(
- theSize: INTEGER;
- redraw: BOOLEAN);
- BEGIN
- SetValue(theSize,redraw);
- TDialogView(GetDialogView).DoSelectEditText(SELF, TRUE)
- END; {SetTextSize}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- FUNCTION TSizeText.Validate: LONGINT;
- OVERRIDE;
- VAR
- result: LONGINT;
-
- BEGIN
- result := INHERITED Validate;
-
- IF (result = kValidValue)
- THEN
- DoChoice(SELF, mTextFontSizeChanged);
-
- Validate := result;
- END;
-
-
- {###############################################################################
- TSizeCluster
- ###############################################################################}
-
- {------------------------------------------------------------------------------}
- {$S AOpen}
-
- { PostRes(): Initialize the dialog's subview references. }
- PROCEDURE TSizeCluster.PostRes;
- OVERRIDE;
- VAR
- aView: TView;
-
- BEGIN
- INHERITED PostRes;
-
- aView := GetDialogView.FindSubView('size');
- FailNil(aView);
- fSizeText := TSizeText(aView);
-
- aView := FindSubView('slst');
- FailNil(aView);
- fSizeListView := TSizeListView(aView);
- END; { PostRes }
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- FUNCTION TSizeCluster.GetTextSize
- :INTEGER;
- BEGIN
- GetTextSize := fSizeText.GetTextSize
- END; {GetTextSize}
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSizeCluster.SetTextSize(
- theSize: INTEGER;
- redraw: BOOLEAN);
-
- BEGIN
- fSizeText.SetTextSize(theSize,redraw);
- fSizeListView.SetTextSize(theSize,redraw)
- END;
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSizeCluster.SetTextFont(
- theFont: INTEGER;
- redraw: BOOLEAN);
- BEGIN
- fSizeListView.InstallFontFamily(theFont);
- fSizeListView.SetTextSize(GetTextSize,redraw)
- END;
-
- {------------------------------------------------------------------------------}
- {$S ACharDlg}
- PROCEDURE TSizeCluster.DoChoice(
- origView: TView;
- itsChoice: INTEGER);
- BEGIN
- CASE itsChoice OF
- mTextFontSizeChanged:
- BEGIN
- {$IFC qDebug}
- Assertion(Member(origView, TSizeText), AtStr('Member(origView, TSizeText)'));
- {$ENDC qDebug}
-
- fSizeListView.SetTextSize(TSizeText(origView).GetTextSize, kRedraw);
- INHERITED DoChoice(origView, mFontSizeChanged);
- END; { mTextFontSizeChanged }
-
- mListFontSizeChanged:
- BEGIN
- {$IFC qDebug}
- Assertion(Member(origView, TSizeListView), AtStr('Member(origView, TSizeListView)'));
- {$ENDC qDebug}
-
- fSizeText.SetTextSize(TSizeListView(origView).GetTextSize, kRedraw);
- INHERITED DoChoice(origView, mFontSizeChanged);
- END; { mListFontSizeChanged }
-
- mFontSizeChanged:
- BEGIN
- {$IFC qDebug}
- ProgramBreak('In TSizeCluster.DoChoice(), unexpected ''mFontSizeChanged'' recieved.');
- {$ENDC qDebug}
-
- INHERITED DoChoice(origView, itsChoice);
- END; { mListFontSizeChanged }
-
- OTHERWISE
- INHERITED DoChoice(origView, itsChoice);
- END; {CASE}
- END; {DoChoice}
-
-
- {###############################################################################
- TCharacterDialogCmd
- ###############################################################################}
-
- {——————————————————————————————————————————————————————————————————————————————}
- {$S ASelCommand}
-
- PROCEDURE TCharacterDialogCmd.ICharacterDialogCmd(
- itsCmdNumber: CmdNumber;
- itsDocument: TDocument;
- itsView: TView;
- itsScroller: TScroller;
- itsTextStyle: TextStyle;
- itsAlignment: INTEGER);
-
- BEGIN
- IMacAppDialogCmd(
- itsCmdNumber,
- itsDocument,
- itsView,
- itsScroller,
- itsCmdNumber, { a handy convention: 'view' rsrc ID <=> CmdNumber }
- 'DLOG');
-
- fTextStyle := itsTextStyle;
- fAlignment := itsAlignment;
- END; { ICharacterDialogCmd }
-
- {——————————————————————————————————————————————————————————————————————————————}
- {$S ADoCommand}
-
- { InitTheDialog(): Initializes the dialog to reflect the command's
- TextStyle and alignment values. }
- PROCEDURE TCharacterDialogCmd.InitTheDialog;
- OVERRIDE;
- VAR
- theTextStyle: TextStyle;
-
- BEGIN
- { localize to avoid unsafe field use }
- theTextStyle := fTextStyle;
-
- { initialize the dialog to act on the command's TextStyle and alignment }
- TCharDialogView(fTheDialog).SetDialogInfo(theTextStyle, fAlignment, kRedraw);
-
- { make sure the 'size' field is the current edit text item }
- fTheDialog.SelectEditText('size', TRUE); { TRUE = DO select the text }
- END; { InitTheDialog }
-
- {——————————————————————————————————————————————————————————————————————————————}
- {$S AFields}
-
- {$IFC qInspector}
- PROCEDURE TCharacterDialogCmd.Fields(
- PROCEDURE DoToField(
- fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER));
- OVERRIDE;
- BEGIN
- DoToField('TCharacterDialogCmd', NIL, bClass);
-
- {$Push} {$H-}
- TextStyleFields('fTextStyle', fTextStyle, DoToField);
- {$Pop}
- DoToField('fAlignment', @fAlignment, bInteger);
-
- INHERITED Fields(DoToField);
- END; { Fields }
- {$ENDC qDebug}
-
-
- {###############################################################################
- TColorDialogCmd
- ###############################################################################}
-
- {——————————————————————————————————————————————————————————————————————————————}
- {$S ASelCommand}
-
- PROCEDURE TColorDialogCmd.IColorDialogCmd(
- itsCmdNumber: CmdNumber;
- itsDocument: TDocument;
- itsView: TView;
- itsScroller: TScroller;
- itsInitialColor: RGBColor;
- itsPromptID: INTEGER);
- BEGIN
- IToolboxDialogCmd(
- itsCmdNumber,
- itsDocument,
- itsView,
- itsScroller,
- -1, { this value wil be ignored }
- [], { this value wil be ignored }
- NIL); { this value wil be ignored }
-
- fInitialColor := itsInitialColor;
- fResultColor := itsInitialColor;
- fPromptID := itsPromptID;
- END; { IColorDialogCmd }
-
- {——————————————————————————————————————————————————————————————————————————————}
- {$S ADoCommand}
-
- PROCEDURE TColorDialogCmd.PoseTheDialog;
- OVERRIDE;
- VAR
- pickerPrompt: StringHandle;
- cancelled: BOOLEAN;
- initialColor: RGBColor;
- resultColor: RGBColor;
-
- BEGIN
- pickerPrompt := GetString(fPromptID);
- FailNil(pickerPrompt);
-
- { localize — That Amazing Moving Memory! }
- initialColor := fInitialColor;
-
- cancelled := NOT GetColor(gZeroPt, pickerPrompt^^, initialColor, resultColor);
- fResultColor := resultColor;
-
- SetCancelled(cancelled);
-
- IF cancelled
- THEN
- SetDismisser(cancel)
- ELSE
- SetDismisser(ok);
- END; { PoseTheDialog }
-
- {——————————————————————————————————————————————————————————————————————————————}
- {$S AFields}
-
- {$IFC qInspector}
- PROCEDURE TColorDialogCmd.Fields(
- PROCEDURE DoToField(
- fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER));
- OVERRIDE;
- BEGIN
- DoToField('TColorDialogCmd', NIL, bClass);
-
- DoToField('fInitialColor', @fInitialColor, bRGBColor);
- DoToField('fResultColor', @fResultColor, bRGBColor);
-
- INHERITED Fields(DoToField);
- END; { Fields }
- {$ENDC qDebug}
-
- {——————————————————————————————————————————————————————————————————————————————}
-